import React from 'react';
import './App.less';
import {observer} from 'mobx-react';
import { ipcRenderer } from 'electron';
import routers from './routers';

@observer
class App extends React.Component {
    displayName = 'App';
    onCloseWin = () => {
        ipcRenderer.send('hide_win', 'base');
    }

    onMinWin = () => {
        ipcRenderer.send('minimize_win', 'base');
    }

    componentDidMount () {
        // ipcRenderer.on('capture', (e, data) => {
        //     this.msg.focus();
        //     document.execCommand("insertImage", false, data.dataURL);
        // });
    }

    render () {
        return (
            <div className='app'>
                <div className='main-body'>
                    <div className='app-tools'>
                        <div className='app-win-ios-tools'>
                            <div className='app-win-titem app-win-close' onClick={this.onCloseWin} title='退出'>
                                <svg t='1598664725657' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2973' width='16' height='16'>
                                    <path d='M572.16 512l183.467-183.04a42.667 42.667 0 1 0-60.587-60.587L512 451.84 328.96 268.373a42.667 42.667 0 0 0-60.587 60.587L451.84 512 268.373 695.04a42.667 42.667 0 0 0 0 60.587 42.667 42.667 0 0 0 60.587 0L512 572.16l183.04 183.467a42.667 42.667 0 0 0 60.587 0 42.667 42.667 0 0 0 0-60.587z' p-id='2974'></path>
                                </svg>
                            </div>
                            <div className='app-win-titem app-win-max' title='最大化'></div>
                            <div className='app-win-titem app-win-min' title='最小化' onClick={this.onMinWin}>
                                <svg t='1601258495106' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='1167' data-darkreader-inline-fill='' width='200' height='200'><path d='M810.666667 554.666667H213.333333a42.666667 42.666667 0 0 1 0-85.333334h597.333334a42.666667 42.666667 0 0 1 0 85.333334z'></path>
                                </svg>
                            </div>
                        </div>
                        <div className='app-menus'>
                            <div className='app-menu-item'>
                                <svg t='1606036790090' className='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4610' width='32' height='32'><path d='M945.68448 217.01632c0-37.60128-30.464-68.0704-68.0704-68.0704H151.50592c-37.59104 0-68.0704 30.46912-68.0704 68.0704L15.36 806.97856c0 37.6064 30.47936 68.07552 68.0704 68.07552h862.25408c37.6064 0 68.07552-30.46912 68.07552-68.07552L945.68448 217.01632z m-68.0704 0v3.91168l0.44544 3.88608 26.36288 228.4032-132.5568-51.67616-98.87232 173.02528-101.78048 33.93024-146.61632-175.9488 166.54336-109.21984V217.01632h286.47424z m-726.10816 3.91168v-3.91168h371.56352V286.5664L380.71808 379.89888l-42.23488-50.67776-218.368 163.76832 30.94528-268.17024 0.44544-3.8912z m-42.1376 365.21472l218.2144-163.65568 221.0816 265.30304 11.81184-3.92704 11.19232 123.11552h-487.7824l25.48224-220.83584z m530.65728 220.83584l-13.20448-145.24928 92.35456-30.78144 82.65728-144.64 111.41632 43.4176 32 277.25312h-305.22368z' p-id='4611' fill='#1296db'></path></svg>
                                <div>矢量</div>
                            </div>
                        </div>
                    </div>
                    <div className='app-content'>
                        <div className='content-header'></div>
                        <div className='content-main'>
                            {routers}
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}

export default App;
